<%@ page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"  %>
<%@ include file="/user/verify_login.jsp" %>
<%
	String id = request.getParameter("id");
	org.languageguide.readings.Reading reading = new org.languageguide.readings.ReadingImpl(id);
	String times = request.getParameter("times");
	System.out.println("times" + times);
	String adjustedWordIds = request.getParameter("adjustedWordIds");
//	String highestIdProcessed = request.getParameter("highestIdProcessed");	
	int update;
	if (adjustedWordIds == null){
		String status = "fine-tuning";
		update = org.languageguide.readings.ReadingManager.saveTimes(id, times, adjustedWordIds, status, user);
	}
	else{
	//System.out.println("id" + id + " " + text);
		update = org.languageguide.readings.ReadingManager.saveTimes(id, times, adjustedWordIds, user);
	}
	if (update > 0){
		response.setContentType("text/xml");
		response.setHeader("Cache-Control", "no-cache");
		response.getWriter().write("<message>valid: yo Buddy</message>"); 
	}
	else{
		response.setContentType("text/xml");
		response.setHeader("Cache-Control", "no-cache");
		response.getWriter().write("<message>invalid: yo Buddy</message>"); 
	}
%>